#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution {
public:
    int arrayPairSum(vector<int>& nums) {
        //此题为贪心算法题目
        sort(nums.begin(),nums.end());
        int result = 0;
        for(int i = 0;i<nums.size();i=i+2){
            result += nums[i];
        }
        return result;
    }
};